// ignore_for_file: unused_import
import 'package:flutter/cupertino.dart';
import '../pages/tabs.dart';
import '../pages/pageView.dart';
import '../pages/pageViewBuilder.dart';
import '../pages/pageViewFullPage.dart';
import '../pages/pageViewSwiper.dart';
import '../tools/feedback.dart';
import '../index/settings.dart';
import '../index/guanyu.dart';
import '../index/alarm.dart';
import '../tools/editor.dart';
import '../pages/user/fensi_tab.dart';
import '../pages/user/guanzhu_tab.dart';
import '../pages/user/huozan_tab.dart';
import '../pages/user/tong_tab.dart';
import '../pages/user/black_list.dart';
import '../tools/search.dart';
import '../pages/tabs/link_page.dart';
import '../pages/tabs/qiyv.dart';
import '../pages/home.dart';
import '../pages/tabs/xiangqing.dart';
final Map<String, Function> routes = {
  '/': (context) => const Tabs(),
  // '/tab': (context) => const Tabs(),
  '/pageView': (context) => const PageViewPage(),
  '/pageViewBuilder': (context) => const PageViewBuilderPage(),
  '/pageViewFullPage': (context) => const PageViewFullPage(),
  '/pageViewSwiper': (context) => const PageViewSwiper(),
  '/feedback': (context) =>  FeedbackPage(),
  '/settings': (context) =>  SettingsPage(),
  '/guanyu': (context) => GuanyuPage(),
  '/alarm': (context) => AlarmPage(),
  '/editor': (context) => EditorPage(),
  '/fensi': (context) => const FensiTab(),
  '/guanzhu': (context) => const GuanzhuTab(),
  '/huozan': (context) => const HuozanTab(),
  '/tong': (context) => const TongTab(),
  '/blacklist': (context) => const blacklistPage(),
  '/search': (context) => SearchPage(),
  '/link': (context) => const LinkPage(),
  '/qiyv': (context) => const QiyvPage(),
  '/xiangqing': (context) => const XiangqingPage(),
};

var onGenerateRoute = (RouteSettings settings) {
  final String? name = settings.name;
  final Function? pageContentBuilder = routes[name];
  if (pageContentBuilder != null) {
    if (settings.arguments != null) {
      final Route route = CupertinoPageRoute(
        builder: (context) =>
            pageContentBuilder(context, arguments: settings.arguments),
      );
      return route;
    } else {
      final Route route = CupertinoPageRoute(
        builder: (context) => pageContentBuilder(context),
      );
      return route;
    }
  }
  return null;
};
